1 package junit.quilt.ui;
2
3 import junit.quilt.util.*;
4 import junit.quilt.framework.*;
5 import junit.quilt.cover.ball94.*;
6
7 import java.lang.reflect.Method;
8
9 import javax.swing.JFrame;
10
11 public class Jips
12 extends JFrame
13 {
14 private RegistryBrowser browser = null;
15 private B94Registry registry = null;
16
17 private class ClassRunner
18 extends Thread
19 {
20 private ClassLoader loader = null;
21 private Class clazz = null;
22 private String args[] = null;
23 private Method main = null;
24
25 public ClassRunner( ClassLoader loader,
26 String className,
27 String args[] )
28 throws Exception
29 {
30 this.loader = loader;
31 this.clazz = loader.loadClass( className );
32 this.args = args;
33 Class sig[] = new Class[1];
34 sig[0] = args.getClass();
35
36 main = clazz.getMethod("main", sig);
37 }
38
39 public void run() {
40 try {
41 Object params[] = new Object[1];
42 params[0] = args;
43 main.invoke( null, params );
44 } catch (Exception e) {
45 e.printStackTrace();
46 }
47 }
48 }
49
50 public Jips( B94Registry registry ) {
51 super();
52
53 this.registry = registry;
54 this.browser = new RegistryBrowser( registry,
55 "jips" );
56 getContentPane().add( browser );
57 pack();
58 }
59
60 public void execute( String className,
61 String args[] )
62 throws Exception
63 {
64 ClassRunner run =
65 new ClassRunner( registry.getInstClassLoader(),
66 className,
67 args);
68 run.start();
69 }
70
71 public static void main(String args[]) {
72 B94Registry registry = new B94Registry();
73 Jips jips = new Jips( registry );
74
75 String secArgs[] = new String[args.length - 1];
76
77 for (int i = 1; i < args.length; i++) {
78 secArgs[i-1] = args[i];
79 }
80
81 try {
82 jips.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
83 jips.pack();
84 jips.setVisible( true );
85 jips.execute( args[0], secArgs );
86 } catch (Exception ex) {
87 ex.printStackTrace();
88 }
89
90 }
91 }
This page was automatically generated by Maven